package defaultPackage;
import java.awt.*;
public class Designation 
{
	int startx,starty,endx,endy;
	int x,y,width,length;
	static int designationArea;
	boolean designating = false, following = false;
	tileType type = tileType.Space;
	
	public Designation()
	{
		designating = false;
	}
	
	public void moveDesignation(Cursor cursor)
	{
    	if (isFollowing())
    	{
			setEndX(cursor.getX());
    		setEndY(cursor.getY());
    	}
		
		width = (Math.abs(endx - startx)) + 10;
		length = Math.abs(endy - starty) + 10;
		
		if (endx >= startx)
			x = startx;
		else if (endx < startx)
			x = endx;
		
		if (endy <= starty)
			y = endy;
		else if (endy > starty)
			y = starty;
		designationArea = width * length / 100;
	}
	
	public void draw(Graphics g)
	{
		
		
		//g.setColor(Color.green);
		//g.drawString(""+ startx, 500, 30);
		//g.drawString(""+ starty, 500, 45);
		//g.drawString(""+ endx, 500, 60);
		//g.drawString(""+ endy, 500, 75);
		//g.drawString(""+ designating, 500, 90);
		if (designating)
		{
			g.setColor(Color.blue);
			g.drawRect(x, y, width, length);
		}
	}
	
	public void setDesignating(boolean designating)
	{
		this.designating = designating;
	}
	
	public boolean isDesignating()
	{
		return designating;
	}
	
	public void setFollowing(boolean following)
	{
		this.following = following;
	}
	
	public boolean isFollowing()
	{
		return following;
	}
	
	public void setStartX(int x)
	{
		 startx = x;
	}
	public void setStartY(int y)
	{
		starty = y;
	}
	
	public void setEndX(int x)
	{
		endx = x;
	}
	public void setEndY(int y)
	{
		endy = y;
	}
	public void resetArea()
	{
		designationArea = 0;
	}
	public int getArea()
	{
		return designationArea;
	}
	public void setDesignationType(tileType type)
	{
		this.type = type;
	}
	public tileType getType()
	{
		return type;
	}
}